<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        英语: <input type="number" v-model.number="user.english">
        语文: <input type="number" v-model.number="user.chinese">
        数学: <input type="number" v-model.number="user.math">

        {{total}}
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            computed: {
                // 一个依赖于  其他数据的变化而变化  （computed）
                total() {
                    return this.user.english + this.user.chinese + this.user.math
                }
            },
            data: {
                user: {
                    english: 100,
                    chinese: 90,
                    math: 99
                }
            }
        })
    </script>
</body>
</html>